<template>
  <div class="card">
    <div class="avatar-wrapper">
      <div class="avatar">
        <i v-if="!info.head_thumb" class="iconfont iconavatar"></i
        ><img v-else :src="$api.imgProjectUrl + info.head_thumb" alt="" />
      </div>
      <div class="status" :class="info.is_check === 0 ? 'danger' : 'success'">
        {{ changeStatus(info.is_check) }}
      </div>
    </div>
    <div class="info-wrapper">
      <p class="name">{{ info.username ? info.username : "未认证会员" }}</p>
      <p>{{ info.mobile }}</p>
      <p class="time">
        <span class="label">注册时间:</span>{{ info.create_time }}
      </p>
    </div>
  </div>
</template>

<script>
export default {
  name: "card",
  props: {
    info: {
      type: Object
    }
  },
  methods: {
    changeStatus(status) {
      switch (status) {
        case 1:
          return "已认证";
        case 0:
          return "未认证";
      }
    },
    goPage(routerName, id) {
      this.$router.push({ name: routerName, query: { id: id } });
    }
  }
};
</script>

<style scoped lang="less">
.card {
  padding: 20px 15px;
  border-radius: 15px;
  margin: 20px 30px;
  display: -webkit-box; /* Chrome 4+, Safari 3.1, iOS Safari 3.2+ */
  display: -moz-box; /* Firefox 17- */
  display: -webkit-flex; /* Chrome 21+, Safari 6.1+, iOS Safari 7+, Opera 15/16 */
  display: -moz-flex; /* Firefox 18+ */
  display: -ms-flexbox; /* IE 10 */
  webkit-box-shadow: 0 0 10px 4px #e1dddd;
  -moz-box-shadow: 0 0 10px 4px #e1dddd;
  box-shadow: 0 0 10px 4px #e1dddd;
  .avatar-wrapper {
    width: 100px;
    position: relative;
    margin-right: 20px;
    .iconfont {
      font-size: 100px;
      color: #246ec3;
      border-radius: 50%;
      webkit-box-shadow: 0 0 0 4px #e1dddd;
      -moz-box-shadow: 0 0 0 4px #e1dddd;
      box-shadow: 0 0 0 4px #e1dddd;
    }
    img {
      width: 100px;
      height: 100px;
      border-radius: 50%;
      webkit-box-shadow: 0 0 0 4px #e1dddd;
      -moz-box-shadow: 0 0 0 4px #e1dddd;
      box-shadow: 0 0 0 4px #e1dddd;
    }
  }
  .status {
    white-space: nowrap;
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translate(-50%, 0);
    font-size: 20px;
    padding: 0.3rem;
    display: inline-block;
    border: 1px solid;
    border-radius: 0.2rem;
  }
  .danger {
    color: #f5222d;
    background: #fff1f0;
    border-color: #ffa39e;
  }
  .success {
    color: #52c41a;
    background: #f6ffed;
    border-color: #b7eb8f;
  }
  .info-wrapper {
    flex: 1;
    text-align: left;
    .name {
      font-weight: bold;
    }
    .time {
      color: gray;
      white-space: nowrap;
      font-size: 0.8rem;
    }
    p {
      font-size: 1rem;
      line-height: 1.4rem;
    }
    .label {
      text-align: left;
      display: inline-block;
      margin-right: 16px;
      width: 100px;
    }
  }
}
</style>
